﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Minutes2Midnight
{
    public partial class frmM2M : Form
    {
        public frmM2M()
        {
            InitializeComponent();
        }

        private void timer_Tick(object sender, EventArgs e)
        {
            TimeSpan timeSpan = DateTime.Now.Date.AddDays(1) - DateTime.Now;
            labelHours.Text = string.Format("{0} of 24 hours left", timeSpan.Hours);
            labelMinutes.Text = string.Format("{0} of 60 minutes left", timeSpan.Minutes);
            labelSeconds.Text = string.Format("{0} of 60 seconds left", timeSpan.Seconds);

            labelTotalMinutes.Text = string.Format("{0} of 1440 total minutes left", timeSpan.TotalMinutes.ToString("#.0"));
            labelTotalSeconds.Text = string.Format("{0} of 86400 total seconds left", timeSpan.TotalSeconds);

            progressBarTotal.Value = 86400 - (int) timeSpan.TotalSeconds;

            progressBarHours.Value = 24 - timeSpan.Hours;
            progressBarMinutes.Value = 60 - timeSpan.Minutes;
            progressBarSeconds.Value = 60 - timeSpan.Seconds;

            progressBarTotalMinutes.Value = 1440 - (int) timeSpan.TotalMinutes;
            progressBarTotalSeconds.Value = 86400 - (int) timeSpan.TotalSeconds;
        }

        private void menuItemAbout_Click(object sender, EventArgs e)
        {
            frmAbout aboutForm = new frmAbout();
            aboutForm.ShowDialog();
        }

        private void menuItemExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}